class User < ActiveRecord::Base
  GROUPS = {
    human: 0,
    camel: 1,
    boss: 2,
    admin: 3,
  }

  def group
    inverted_groups[super]
  end

  def group=(x)
    super GROUPS[x]
  end

  private

  def inverted_groups
    @inverted_groups ||= GROUPS.invert
  end
end
